<!-- meta page description: Display drivers -->
<!-- meta page index: display --> 

The current command line rendering mechanism is direct rendering into
a file. The driver is selected by setting
the <tt>GRASS_RENDER_IMMEDIATE</tt> variable or by
running <em><a href="d.mon.html">d.mon</a></em> module.

<p>
<b>List of available display drivers:</b>
<ul>
  <li><a href="cairodriver.html">Cairo driver</a>
  <li><a href="pngdriver.html">PNG driver</a>
  <li><a href="psdriver.html">PS driver (Postscript)</a>
  <li><a href="htmldriver.html">HTMLMAP driver</a>
</ul>

<h2>NOTES</h2>

<h3>GRASS_RENDER_COMMAND</h3>

If environmental variable GRASS_RENDER_COMMAND is defined,
rendering is redirected by display library to the given external command
defined by this variable. Currently only Python scrips are supported.

<p>
Lets start with simple example of Python script called <i>render.py</i>:

<div class="code"><pre>
#!/usr/bin/env python3

import os
import sys

import grass.script as gs
from grass.script import task as gtask

os.environ['GRASS_RENDER_IMMEDIATE'] = 'default'
os.environ['GRASS_RENDER_FILE'] = 'output.png'

cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])

gs.run_command('d.text', text="Test of GRASS_RENDER_COMMAND redirection")

os.environ['GRASS_RENDER_FILE_READ'] = 'TRUE'
gs.run_command(cmd, **dcmd)
</pre></div>

After defining GRASS_RENDER_COMMAND variable (example for Bash):

<div class="code"><pre>
export GRASS_RENDER_COMMAND=render.py
</pre></div>

Display GRASS modules like <em><a href="d.rast.html">d.rast</a></em>
or <em><a href="d.vect.html">d.vect</a></em> will be executed
by <i>render.py</i> program.

For example the command

<div class="code"><pre>
d.vect roadsmajor
</pre></div>

produces output PNG file <i>output.png</i> which will contain rendered
features from vector map <i>roadsmajor</i> and sample text <i>&quot;Test of
GRASS_RENDER_COMMAND redirection&quot;</i>.

<h2>SEE ALSO</h2>

<em>
<a href="d.mon.html">d.mon</a>,
<a href="variables.html#list-of-selected-grass-environment-variables-for-rendering">variables</a>
</em>
